package com.cdl;

import java.util.Arrays;

/**
 * @author cdl
 * @date 2025/9/29
 */
public class Demo3 {
    public static void main(String[] args) {


//        int[] anOtherArray = new int[] {1,2,3,4,5};
//
//        for (int i =  0; i <anOtherArray.length; i++){
//            System.out.println(anOtherArray[i]);
//        }
//
//        for (int element : anOtherArray){
//            System.out.println(element);
//        }
//
//
//        int[] anArray  = new int[] {1,2,3,4,5};
//        List<Integer>  aList = new ArrayList<>();
//        for (int element : anArray){
//            aList.add(element);
//        }
//
//
//        List<int[]> aList1 = Collections.singletonList(anArray);
        int[][] oddNumbers = { {1, 3, 5, 7}, {9, 11, 13, 15}, {17, 19, 21, 23}};

        for(int i = 0; i<oddNumbers.length;i++){
            for (int j=0; j<oddNumbers[i].length;j++){
                System.out.println(oddNumbers[i][j]);
            }
        }

        String [] cmowers = {"沉默","王二","一枚有趣的程序员"};
        System.out.println(Arrays.toString(cmowers));

        String x ="dfdfdfaf";
        System.out.println(x.hashCode());

        String str = "Hello,world!";
        String subStr = str.substring(7,12);
        System.out.println(subStr);

        String prefix = str.substring(0,5);
        String suffix = str.substring(7);
        System.out.println(prefix);
        System.out.println(suffix);

        String str1 = "  Hello,  world!";
        String trimmed = str1.trim();
        String[] words = trimmed.split("\\s+");// 将字符串按照空格分隔成单词数组
        String firstWord = words[0].substring(0,1);

        System.out.println(trimmed);
        System.out.println(Arrays.toString(words));
        System.out.println(firstWord);

        String text = "沉默王二";
        char[] chars = text.toCharArray();
        System.out.println(Arrays.toString(chars));






    }


}
